package com.industrial.premu.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.industrial.common.log.annotation.Log;
import com.industrial.common.log.enums.BusinessType;
import com.industrial.common.security.annotation.RequiresPermissions;
import com.industrial.premu.domain.PreMuIndexsManager;
import com.industrial.premu.service.IPreMuIndexsManagerService;
import com.industrial.common.core.web.controller.BaseController;
import com.industrial.common.core.web.domain.AjaxResult;
import com.industrial.common.core.utils.poi.ExcelUtil;
import com.industrial.common.core.web.page.TableDataInfo;

/**
 * 指标设置（省级）Controller
 * 
 * @author ZHOU_S
 * @date 2024-01-22
 */
@RestController
@RequestMapping("/manager")
public class PreMuIndexsManagerController extends BaseController
{
    @Autowired
    private IPreMuIndexsManagerService preMuIndexsManagerService;


/*
    @GetMapping(value = "/booleanPreMuIndexs")
        public AjaxResult booleanPreMuIndexs(String years,String enterType)
    {
        return success(preMuIndexsManagerService.booleanPreMuIndexs(years,enterType));
    }
*/


    @GetMapping("/groupYears")
    public TableDataInfo groupYears(PreMuIndexsManager preMuIndexsManager)
    {
        startPage();
        List<PreMuIndexsManager> list = preMuIndexsManagerService.groupYears(preMuIndexsManager);
        return getDataTable(list);
    }
    /**
     * 查询指标设置（省级）列表
     */
    @RequiresPermissions("premu:manager:list")
    @GetMapping("/list")
    public TableDataInfo list(PreMuIndexsManager preMuIndexsManager)
    {
        startPage();
        List<PreMuIndexsManager> list = preMuIndexsManagerService.selectPreMuIndexsManagerList(preMuIndexsManager);
        return getDataTable(list);
    }

    /**
     * 导出指标设置（省级）列表
     */
    @RequiresPermissions("premu:manager:export")
    @Log(title = "指标设置（省级）", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PreMuIndexsManager preMuIndexsManager)
    {
        List<PreMuIndexsManager> list = preMuIndexsManagerService.selectPreMuIndexsManagerList(preMuIndexsManager);
        ExcelUtil<PreMuIndexsManager> util = new ExcelUtil<PreMuIndexsManager>(PreMuIndexsManager.class);
        util.exportExcel(response, list, "指标设置（省级）数据");
    }

    /**
     * 获取指标设置（省级）详细信息
     */
    @RequiresPermissions("premu:manager:query")
    @GetMapping(value = "/{baseId}")
    public AjaxResult getInfo(@PathVariable("baseId") String baseId)
    {
        return success(preMuIndexsManagerService.selectPreMuIndexsManagerByBaseId(baseId));
    }

    /**
     * 新增指标设置（省级）
     */
    @RequiresPermissions("premu:manager:add")
    @Log(title = "指标设置（省级）", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PreMuIndexsManager preMuIndexsManager)
    {
        return toAjax(preMuIndexsManagerService.insertPreMuIndexsManager(preMuIndexsManager));
    }

    /**
     * 修改指标设置（省级）
     */
    @RequiresPermissions("premu:manager:edit")
    @Log(title = "指标设置（省级）", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PreMuIndexsManager preMuIndexsManager)
    {
        return toAjax(preMuIndexsManagerService.updatePreMuIndexsManager(preMuIndexsManager));
    }

    /**
     * 删除指标设置（省级）
     */
    @RequiresPermissions("premu:manager:remove")
    @Log(title = "指标设置（省级）", businessType = BusinessType.DELETE)
	@DeleteMapping("/{baseIds}")
    public AjaxResult remove(@PathVariable String[] baseIds)
    {
        return toAjax(preMuIndexsManagerService.deletePreMuIndexsManagerByBaseIds(baseIds));
    }
}
